package com.cbn.ibcp.web.jishiting.operator.convert;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.cbn.ibcp.common.utils.bean.BeanUtils;
import com.cbn.ibcp.jishiting.media.bo.EpisodeResourceStreamBO;
import com.cbn.ibcp.jishiting.rms.bo.ResourceStreamBO;
import com.cbn.ibcp.web.jishiting.operator.vo.EpisodeResourceStreamVO;
import com.cbn.ibcp.web.jishiting.operator.vo.ResourceStreamVO;

public class ResourceStreamBOConvert {

    public static ResourceStreamVO convertToResourceStreamVO(ResourceStreamBO resourceStreamBO) {
        if (resourceStreamBO == null) {
            return null;
        }
        ResourceStreamVO resourceStreamVO = new ResourceStreamVO();
        BeanUtils.copyBeanProp(resourceStreamVO, resourceStreamBO);
        resourceStreamVO.setId(StrUtil.toStringOrNull(resourceStreamBO.getId()));
        resourceStreamVO.setEpisodeId(StrUtil.toStringOrNull(resourceStreamBO.getEpisodeId()));
        resourceStreamVO.setEpisodeName(resourceStreamBO.getEpisodeName());
        resourceStreamVO.setAlbumId(StrUtil.toStringOrNull(resourceStreamBO.getAlbumId()));
        resourceStreamVO.setAlbumName(StrUtil.toStringOrNull(resourceStreamBO.getAlbumName()));
        resourceStreamVO.setRmsCpCode(resourceStreamBO.getCpCode());
        resourceStreamVO.setSourceId(StrUtil.toStringOrNull(resourceStreamBO.getSourceId()));
        resourceStreamVO.setCreateTime(DateUtil.format(resourceStreamBO.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
        resourceStreamVO.setUpdateTime(DateUtil.format(resourceStreamBO.getUpdateTime(), DatePattern.NORM_DATETIME_PATTERN));
        return resourceStreamVO;
    }
}
